﻿using System.Collections.Generic;

namespace TC
{
    public class IntAdd : VariableNode
    {
        public List<ValueInput<int>> items = new List<ValueInput<int>>();
        public ValueOutput<int> value;

        public override void OnCreate()
        {
            base.OnCreate();

            items = new List<ValueInput<int>>();
            value = this.AddValueOutPort<int>("value", () =>
            {
                int tmp = 0;
                for (int i = 0; i < items.Count; ++i)
                {
                    tmp += items[i].Value;
                }
                return tmp;
            });
        }
    }
}
